<?php

namespace Apps\AppApi\Method\MyBranch;

use Apps\AppApi\Method\BaseMethod;
use Apps\Common\Libs\Keyword;
use Apps\Common\Libs\UploadPic;
use PhalconPlus\Api\Common\ResultStatus;
use Apps\Common\Models\CosQKeyword;
use Apps\Common\Models\BeautyParlorService;
use Phalcon\Mvc\Model;
use Apps\Common\Models\BeautyParlorInteractive;


/**
 * 修改|发布服务
 * @author      545
 * @date        2016年3月12日
 * @version     1.1.2
 * @copyright   Copyright 2015 meelier.com
 */
class ModifyInteractive extends BaseMethod
{
    
    private $success = 0;
    private $id = 0;
    private $message;
    
    public function run()
    {
    	/**
         * 验证用户权限
         */
        if(false == $this->verifyUserAuth()){
            return false;
        }
        $bp_id = intval($this -> getDataItem('bp_id',0));
        $ids = $this->getDataItem('ids','');
        
        if (!is_array($ids)||$bp_id==0){
            return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR,"数据不全");
        }
        
        $idstr = implode(',', $ids);
            
        $bpinteractive = new BeautyParlorInteractive();
        
        if ($bpinteractive->updateState($idstr,$bp_id)){
            $this->message = "删除美粒互动成功";
            $this->success = 1;
        }
        else{
            $this->message = "删除美粒互动失败";
            $this->success = 0;
        }
            

        $this->setResult([
            'success' => $this->success,
            'message' => $this->message
        ]);
    }

}